
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ul{
            display: flex;
        }
        li{
            width: 60px;
            height: 50px;
            border: 1px solid #999999;
            font-weight: 900;
            list-style: none;
            text-align: center;
            line-height: 50px;

        }
        #yangshi{
            border: 3px solid #666666;
        }
    </style>
</head>
<body>
    <ul>
        <li class="li">S</li>
        <li class="li">M</li>
        <li class="li">L</li>
        <li class="li">XL</li>
    </ul>
</body>
<script>
    /* 1.获取到三个按钮
    2.给每个按钮绑定点击事件
    3.当用户点击时 让所有的li去掉选中样式
    4.再给点击的这个 */
    var lis = document.querySelectorAll('li')
    for(var i = 0; i < lis.length; i++){
        lis[i].onclick =function(){
            for(var j = 0; j<lis.length;j++){
                lis[j].id= ''
            }
            this.id='yangshi'
        }
    }
</script>
</html>